<?php
require '../conn.php';
require 'config.php';
require '../inc/function.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../css/admin.css" type="text/css" />
<script type="text/javascript" src="inc/function.js"></script>
</head>
<body>
<?php
switch($act){
case 'delete':
	$image_original=RsField_Array('select e_image from '.$language.'_exhpy where e_id='.$id);
	mysql_query('delete from '.$language.'_exhpy where e_id='.$id);
	DeleteFile('../'.$image_original[0]);
	Msg('','Referer');
	break;
case 'deletes':
	if (count($_POST['checkbox'])>0){
		$id_arr=implode(',',$_POST['checkbox']);
		$query=mysql_query("select e_id,e_image from ".$language."_exhpy where e_id in ($id_arr)");
		if (mysql_num_rows($query)>0){
		while($row=mysql_fetch_array($query)){
			mysql_query('delete from '.$language.'_exhpy where e_id='.$row['e_id']);
			DeleteFile('../'.$row['e_image']);
		}
		}
	}
	Msg('删除数据成功！','Referer');
	break;
}
$class_name=RsField('select e_name from '.$language.'_exhibition_class where e_id='.$meter);
?>
<div id="container">
	<input type="text" id="search_key" class="search_input" size="30" value="<?php echo  $search_key ?>" />
	<input type="button" name="button" class="search_button" value="搜 索" onclick="location.href='?meter=<?php echo $meter ?>&search_key='+$('search_key').value" />
	<div class="view" style="margin-top:5px;">
		<h1>展商及买家评语 - <?php echo $class_name ?><a href="javascript:location.reload();">刷新</a></h1>
		<form name="form1" id="form1" method="post" action="?act=deletes&<?php echo $urls ?>">
	    <table width="100%" border="0" cellpadding="0" cellspacing="0">
        	<tr class="v_title">
            	<td width="10%">ID号</td>
				<td width="15%">展会图片</td>
				<td width="50%">展会名称</td>
				<td width="10%">展会排序</td>
				<td width="15%">操作</td>
        	</tr>
			<?php
			$str='';
			$page_size=10;
			if ($search_key!='') $sqls=" and e_name like '%{$search_key}%'";
			$page_sql='select e_id,e_class,e_order,e_name,e_image from '.$language.'_exhpy where e_class='.$meter.$sqls;
			$sqls_order=' order by e_order,e_id';
			if ($search_key!='') $sqls_order=' order by e_id desc';
			$page_sql.=$sqls_order;
			$page_count=GetPageCount($page_size,$page_sql);
			if ($page>$page_count) $page=$page_count;
			$page_number=($page-1)*$page_size;
			$query=mysql_query($page_sql." limit $page_number,$page_size",$conn);
			if (mysql_num_rows($query)>0){
			while($row=mysql_fetch_array($query)){
				$str.='<tr onmouseover="this.className=\'view_trover\';" onmouseout="this.className=\'view_trout\';">';
				$str.='<td><input type="checkbox" name="checkbox[]" value="'.$row['e_id'].'" align="absmiddle" />&nbsp;'.$row['e_id'].'</td>';
				$str.='<td style="line-height:normal; font-size:0px;"><a href="../'.$row['e_image'].'" target="_blank"><img src="../'.$row['e_image'].'" height="40" style="margin:5px auto;" /></a></td>';
				$str.='<td><a href="../exhpy_detail.php?exhid='.$row['e_class'].'&id='.$row['e_id'].'" target="_blank">'.$row['e_name'].'</a></td>';
				if ($search_key!=''){
					$str.='<td>'.$row['e_order'].'</td>';
				}
				else {
					$str.='<td><div class="inputorder" id="inputorder_'.$row['e_id'].'" contenteditable="true" onblur="Order(\'exhpy\','.$row['e_id'].')">'.$row['e_order'].'</div></td>';
				}
				$str.='<td><a href="exhpy_modify.php?'.$urls.'&id='.$row['e_id'].'">修改</a> | <a href="?act=delete&id='.$row['e_id'].'" onclick="return ConfirmDel();">删除</a></td>';
				$str.='</tr>';
			}
			}
			else {
				$page_show=false;
			}
			echo $str;
			?>
		</table>
		</form>
		<?php if($page_show) echo ShowPage($page,$page_size,$page_sql); ?>
	</div>
</div>
</body>
</html>